<?php
class information_model extends MY_model
{
    public $id;
    public $content;

    public function get_elements()
    {
        $query = $this->db->query("SELECT * FROM information");
        return $this->to_domain_models($query->result());
    }

    public function get_element_by_id($id)
    {
        $query = $this->db->query("SELECT * FROM information WHERE id = ?",array($id));
        return $this->to_domain_model($query->row());
    }

    public function get_first_element()
    {
        $query = $this->db->query("SELECT * FROM information LIMIT 0,1",array());
        return $this->to_domain_model($query->row());
    }

    // -------------------------------------------------------------------------------- PRIVATE PROPERTIES

    // -------------------------------------------------------------------------------- PRIVATE METHOD

    // Private method
    public function to_domain_model($item)
    {
        $model = new information_model();
        $model->id = isset($item->id) ? $item->id : '' ;
        $model->content = isset($item->content) ? $item->content : '' ;
        return $model;
    }
}